import request from '../utils/request';
import {service_host} from './config';

export async function sendDingNews(ding) {
  return request(`${service_host}/testrecord/sendNews`, {
      method: 'POST',
      body: {
        projectName:ding.projectName,
        news:{
          "msgtype": "link", 
          "link": {
              "text":ding.text, 
             "title": ding.title, 
              "picUrl": "", 
              "messageUrl": "http://192.168.15.243/testcenter/testrecord"
          }
      }
      }
  });
}

export async function callUser(ding) {
    return request(`${service_host}/testrecord/sendNews`, {
        method: 'POST',
        body: {
            projectName: ding.projectName,
            news:{
                "msgtype": "text",
                "text": {
                    "content": ding.text
                },
                "at": {
                    "atMobiles": [
                    ding.mobile
                    ], 
                }
            }
        }       
    });
  }